/* eslint-disable */
// @ts-ignore
import { queryOptions, useMutation } from '@tanstack/vue-query';
import type { DefaultError } from '@tanstack/vue-query';
import request from '@/utils/request';
import { CustomRequestOptions } from '@/interceptors/request';

import * as apis from './vehicleController';
import * as API from './types';

/** vehicle新增 POST /api/vehicle/add */
export function useAddUsingPost3Mutation(options?: {
  onSuccess?: (value?: API.AjaxResultobject) => void;
  onError?: (error?: DefaultError) => void;
}) {
  const { onSuccess, onError } = options || {};

  const response = useMutation({
    mutationFn: apis.addUsingPost3,
    onSuccess(data: API.AjaxResultobject) {
      onSuccess?.(data);
    },
    onError(error) {
      onError?.(error);
    },
  });

  return response;
}

/** vehicle删除 POST /api/vehicle/del */
export function useDelUsingPost3Mutation(options?: {
  onSuccess?: (value?: API.AjaxResultobject) => void;
  onError?: (error?: DefaultError) => void;
}) {
  const { onSuccess, onError } = options || {};

  const response = useMutation({
    mutationFn: apis.delUsingPost3,
    onSuccess(data: API.AjaxResultobject) {
      onSuccess?.(data);
    },
    onError(error) {
      onError?.(error);
    },
  });

  return response;
}

/** vehicle详情 GET /api/vehicle/detail */
export function detailUsingGet6QueryOptions(options: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.detailUsingGET6Params;
  options?: CustomRequestOptions;
}) {
  return queryOptions({
    queryFn: async ({ queryKey }) => {
      return apis.detailUsingGet6(queryKey[1] as typeof options);
    },
    queryKey: ['detailUsingGet6', options],
  });
}

/** vehicle编辑 POST /api/vehicle/edit */
export function useEditUsingPost3Mutation(options?: {
  onSuccess?: (value?: API.AjaxResultobject) => void;
  onError?: (error?: DefaultError) => void;
}) {
  const { onSuccess, onError } = options || {};

  const response = useMutation({
    mutationFn: apis.editUsingPost3,
    onSuccess(data: API.AjaxResultobject) {
      onSuccess?.(data);
    },
    onError(error) {
      onError?.(error);
    },
  });

  return response;
}

/** vehicle列表 GET /api/vehicle/list */
export function listUsingGet7QueryOptions(options: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.listUsingGET7Params;
  options?: CustomRequestOptions;
}) {
  return queryOptions({
    queryFn: async ({ queryKey }) => {
      return apis.listUsingGet7(queryKey[1] as typeof options);
    },
    queryKey: ['listUsingGet7', options],
  });
}

/** vehicle列表 GET /api/vehicle/listAll */
export function listAllUsingGetQueryOptions(options: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.listAllUsingGETParams;
  options?: CustomRequestOptions;
}) {
  return queryOptions({
    queryFn: async ({ queryKey }) => {
      return apis.listAllUsingGet(queryKey[1] as typeof options);
    },
    queryKey: ['listAllUsingGet', options],
  });
}
